<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/restrict/adminHome.xhtml">
	<ui:define name="titulo">
    	<h:outputLabel value="#{msg.albuns} #{msg.cadastrados}"/>          
    </ui:define>

	<ui:define name="cont">
		<p:messages />
		<p:panel>
			<h:form id="form">
				<p:dataTable id="datatable" var="album" value="#{albumManagedBean.albumDataModel}"
					emptyMessage="#{msg.nenhumItem}" paginator="true" rows="25" paginatorPosition="bottom"
					selection="#{albumManagedBean.albunsSelect}" styleClass="table">

				<f:facet name="header">  
    	           <h:outputLabel value="#{msg.albuns} #{msg.cadastrados} - MusicBay.com"/>  
                </f:facet>

					<p:column style="width:5px" headerText="#{msg.editar}">
						<p:button id="selectButton" icon="ui-icon-wrench" outcome="albumEdit">
							<f:param name="album" value="#{album.idAlbum}" />
						</p:button>
					</p:column>

					<p:column selectionMode="multiple" style="width:18px" />


					<p:column headerText="#{msg.album}" filterBy="#{album.nome}" filterMatchMode="contains" sortBy="#{album.nome}">
						<h:link value="#{album.nome}" outcome="albumPage" id="albumPage">
							<f:param name="album" value="#{album.idAlbum}" />
						</h:link>
					</p:column>

					<p:column headerText="#{msg.ano}" sortBy="#{album.ano}" >
                    	<h:outputLabel value="#{album.ano}"/>
                    </p:column>

					<p:column headerText="#{msg.artista}" filterBy="#{album.artista.nome}" filterMatchMode="contains" sortBy="#{album.artista.nome}">
						<h:link value="#{album.artista.nome}" outcome="artistaPage" id="artistaPage">
							<f:param name="artista" value="#{album.artista.idArtista}" />
						</h:link>
					</p:column>

					<p:column headerText="#{msg.status}" sortBy="#{album.status}">
						<h:outputLabel value="#{msg.ativo}" rendered="#{album.status == 1}" />
						<h:outputLabel value="#{msg.inativo}" rendered="#{album.status == 0}" />
					</p:column>
				</p:dataTable>

				<p:commandButton id="novo" value="#{msg.novo}" action="cadastro" styleClass="buttonAction"
					icon="ui-icon-document" />
				<p:commandButton id="showDeleteDialog" value="#{msg.excluir}" oncomplete="deleteDialog.show()"
					update=":form:displayMulti1" styleClass="buttonAction" icon="ui-icon-close" />


				<p:confirmDialog id="excluirDialog" message="#{msg.confirma} #{msg.delecao}?"
					header="#{msg.confirma} #{msg.delecao}?" severity="alert" widgetVar="deleteDialog">

					<p:dataList id="displayMulti1" value="#{albumManagedBean.albunsSelect}" var="album">  
                    	<h:outputLabel value="#{album.nome}"/> 
                    </p:dataList>
					<h:form>
						<p:commandButton id="confirma" value="#{msg.confirma}" ajax="false"
							actionListener="#{albumManagedBean.actionDelete}" oncomplete="deleteDialog.hide()"
							icon="ui-icon-check" />
						<p:commandButton id="cancela" value="#{msg.cancelar}" onclick="deleteDialog.hide()" type="button"
							icon="ui-icon-cancel" />
					</h:form>

				</p:confirmDialog>
			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>
</html>

